local burningSkill = fk.CreateSkill {
  name = "burningSkill",
  tags = { Skill.Compulsory, },
}


burningSkill:addEffect(fk.DamageInflicted, {
  anim_type = "negative",
  priority = 0.09,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(burningSkill.name) and target == player and data.damageType == fk.FireDamage
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:addPlayerMark(player,"@up_fire",1)
  end,
})

burningSkill:addEffect(fk.TurnStart, {
  anim_type = "negative",
  priority = 0.09,
  can_trigger = function(self, event, target, player, data)
    return target == player and player:getMark("@up_fire") > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local curmark = player:getMark("@up_fire")
    local firedamge = math.floor(curmark/2)
    if firedamge > 0 then
      room:loseHp(player,firedamge,burningSkill.name)
    end
    room:removePlayerMark(player,"@up_fire",1)
    if curmark == 1 then
      room:handleAddLoseSkills(player, "-burningSkill", nil, false)
    end
  end,
})

burningSkill:addEffect(fk.EventLoseSkill, {
  anim_type = "negative",
  priority = 0.09,
  can_trigger = function(self, event, target, player, data)
    return player == target and data == self and player:getMark("@up_fire") > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player,"@up_fire",0)
  end,
})


return burningSkill